home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / Net::protoent.z / Net::protoent
Encoding:
Text File  |  1998-10-30  |  3.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4. NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))                                              NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Net::protoent - by-name interface to Perl's built-in getproto*()
  10.      functions
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       use Net::protoent;
  14.       $p = getprotobyname(shift || 'tcp') || die "no proto";
  15.       printf "proto for %s is %d, aliases are %s\n",
  16.          $p->name, $p->proto, "@{$p->aliases}";
  17.  
  18.       use Net::protoent qw(:FIELDS);
  19.       getprotobyname(shift || 'tcp') || die "no proto";
  20.       print "proto for $p_name is $p_proto, aliases are @p_aliases\n";
  21.  
  22.  
  23. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  24.      This module's default exports override the core _g_e_t_p_r_o_t_o_e_n_t(),
  25.      _g_e_t_p_r_o_t_o_b_y_n_a_m_e(), and _g_e_t_n_e_t_b_y_p_o_r_t() functions, replacing them with
  26.      versions that return "Net::protoent" objects.  They take default second
  27.      arguments of "tcp".  This object has methods that return the similarly
  28.      named structure field name from the C's protoent structure from _n_e_t_d_b._h;
  29.      namely name, aliases, and proto.  The aliases method returns an array
  30.      reference, the rest scalars.
  31.  
  32.      You may also import all the structure fields directly into your namespace
  33.      as regular variables using the :FIELDS import tag.  (Note that this still
  34.      overrides your core functions.)  Access these fields as variables named
  35.      with a preceding p_.  Thus, $proto_obj->_n_a_m_e() corresponds to $p_name if
  36.      you import the fields.  Array references are available as regular array
  37.      variables, so for example @{ $proto_obj->_a_l_i_a_s_e_s() } would be simply
  38.      @p_aliases.
  39.  
  40.      The _g_e_t_p_r_o_t_o() function is a simple front-end that forwards a numeric
  41.      argument to _g_e_t_p_r_o_t_o_b_y_p_o_r_t(), and the rest to _g_e_t_p_r_o_t_o_b_y_n_a_m_e().
  42.  
  43.      To access this functionality without the core overrides, pass the use an
  44.      empty import list, and then access function functions with their full
  45.      qualified names.  On the other hand, the built-ins are still available
  46.      via the CORE:: pseudo-package.
  47.  
  48. NNNNOOOOTTTTEEEE
  49.      While this class is currently implemented using the Class::Struct module
  50.      to build a struct-like class, you shouldn't rely upon this.
  51.  
  52. AAAAUUUUTTTTHHHHOOOORRRR
  53.      Tom Christiansen
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))                                              NNNNeeeetttt::::::::pppprrrroooottttooooeeeennnntttt((((3333))))
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                                                         PPPPaaaaggggeeee 2222
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.